package test;

import java.util.Calendar;
import java.util.Scanner;

public class HW11 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Calendar time1 = Calendar.getInstance();
        System.out.println("输入出生月份");
        int month = sc.nextInt();
        System.out.println("输入出生日期");
        int day = sc.nextInt();

        int sum = 0;
        while (true) {
            if (time1.get(Calendar.MONTH) + 1 == month && time1.get(Calendar.DATE) == day) {
                break;
            } 
            time1.add(Calendar.DATE, 1);
            sum++;
            
        }
        System.out.println("下次生日的时间:"+time1.getTime());
        System.out.println("还剩" + sum + "天");

//        if (month == 2 && day == 29 && (time1.get(Calendar.MONTH) > 2 )) {
//            System.out.println("还剩" + (sum + (4 - time1.get(Calendar.YEAR) % 4) * 365) + "天");
//        } else {
//            System.out.println("还剩" + sum + "天");
//        }
    }
}
